import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
//import Index from '../views/Index.vue'

Vue.use(VueRouter)

const routes = [
  { 
    path: '/:pathMatch(.*)',
    component: () => import(/* webpackChunkName: "index" */ '../views/Index.vue') 
  },
  {
    path: '/',
    name: 'Home',
    component: Home,
    meta:{
      // 页面标题title
      title: '首页'
    }
  },
  {
    path: '/index',
    name: 'Index',
    //redirect: '/index/detail',
    component: () => import(/* webpackChunkName: "index" */ '../views/Index.vue'),
    meta:{
      // 页面标题title
      title: '点餐'
    },
    children:[
      {
        path: 'orderBox',
        name: 'orderBox',
        meta:{
          // 页面标题title
          title: '详情'
        },
        component: () => import(/* webpackChunkName: "index" */ '../components/orderBox/orderBox.vue'),
      },
      {
        path: 'packageProduct',
        name: 'packageProduct',
        meta:{
          // 页面标题title
          title: '详情'
        },
        component: () => import(/* webpackChunkName: "index" */ '../components/packageProduct/packageProduct.vue'),
      },
      {
        path: 'productMethods',
        name: 'productMethods',
        meta:{
          // 页面标题title
          title: '详情'
        },
        component: () => import(/* webpackChunkName: "index" */ '../components/productMethods/productMethods.vue'),
      },{
        path: 'replaceBox',
        name: 'replaceBox',
        meta:{
          // 页面标题title
          title: '详情'
        },
        component: () => import(/* webpackChunkName: "index" */ '../components/replaceBox/replaceBox.vue'),
      }
    ]
  },
  {
    path: '/search',
    name: 'Search',
    meta:{
      // 页面标题title
      title: '搜索'
    },
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/search.vue')
  },
  {
    path: '/detail',
    name: 'Detail',
    meta:{
      // 页面标题title
      title: '详情'
    },
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/productDetail.vue')
  },
  {
    path: '/receiptApply',
    name: 'ReceiptApply',
    meta:{
      // 页面标题title
      title: '详情'
    },
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/receiptApply.vue')
  },
  {
    path: '/appraise',
    name: 'Appraise',
    meta:{
      // 页面标题title
      title: '评价'
    },
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/appraise.vue')
  },
  {
    path: '/toOrder',
    name: 'ToOrder',
    meta:{
      // 页面标题title
      title: '下单'
    },
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/toOrder.vue')
  },
  {
    path: '/remark',
    name: 'Remark',
    meta:{
      // 页面标题title
      title: '备注'
    },
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/remark.vue')
  },
  {
    path: '/orderDetail',
    name: 'OrderDetail',
    meta:{
      // 页面标题title
      title: '订单详情'
    },
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/orderDetail.vue')
  },
  {
    path: '/orderSuccess',
    name: 'OrderSuccess',
    meta:{
      // 页面标题title
      title: '下单成功'
    },
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/orderSuccess.vue')
  },
  {
    path: '/orderList',
    name: 'OrderList',
    meta:{
      // 页面标题title
      title: '订单列表'
    },
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/orderList.vue')
  },
  {
    path: '/submitSuccess',
    name: 'submitSuccess',
    meta:{
      // 页面标题title
      title: '提交成功'
    },
    component: () => import(/* webpackChunkName: "about" */ '../views/submitSuccess.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  routes:  routes
})

export default router
